
#ifndef Random_h
#define Random_h

// Riccsson includes.
#include <System/Array.h>

namespace Riccsson
{
	namespace System
	{
		// Summary:
		//     Represents a pseudo-random number generator, a device that produces a sequence
		//     of numbers that meet certain statistical requirements for randomness.
		//[Serializable]
		//[ComVisible(true)]
		class Random
		{
		private:
			static const int MBIG;
            static const int MSEED;

            int inext;
			int inextp;
            int SeedArray[56];

			private: void init(int seed);

			// Summary:
			//     Initializes a new instance of the System.Random class, using a time-dependent
			//     default seed value.
			public: Random();
			//
			// Summary:
			//     Initializes a new instance of the System.Random class, using the specified
			//     seed value.
			//
			// Parameters:
			//   Seed:
			//     A number used to calculate a starting value for the pseudo-random number
			//     sequence. If a negative number is specified, the absolute value of the number
			//     is used.
			public: Random(int Seed);

			// Summary:
			//     Returns a nonnegative random number.
			//
			// Returns:
			//     A 32-bit signed integer greater than or equal to zero and less than System.Int32.MaxValue.
			//[TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
			public: virtual int Next();
			//
			// Summary:
			//     Returns a nonnegative random number less than the specified maximum.
			//
			// Parameters:
			//   maxValue:
			//     The exclusive upper bound of the random number to be generated. maxValue
			//     must be greater than or equal to zero.
			//
			// Returns:
			//     A 32-bit signed integer greater than or equal to zero, and less than maxValue;
			//     that is, the range of return values ordinarily includes zero but not maxValue.
			//     However, if maxValue equals zero, maxValue is returned.
			//
			// Exceptions:
			//   System.ArgumentOutOfRangeException:
			//     maxValue is less than zero.
			public: virtual int Next(int maxValue);
			//
			// Summary:
			//     Returns a random number within a specified range.
			//
			// Parameters:
			//   minValue:
			//     The inclusive lower bound of the random number returned.
			//
			//   maxValue:
			//     The exclusive upper bound of the random number returned. maxValue must be
			//     greater than or equal to minValue.
			//
			// Returns:
			//     A 32-bit signed integer greater than or equal to minValue and less than maxValue;
			//     that is, the range of return values includes minValue but not maxValue. If
			//     minValue equals maxValue, minValue is returned.
			//
			// Exceptions:
			//   System.ArgumentOutOfRangeException:
			//     minValue is greater than maxValue.
			public: virtual int Next(int minValue, int maxValue);
			//
			// Summary:
			//     Fills the elements of a specified array of bytes with random numbers.
			//
			// Parameters:
			//   buffer:
			//     An array of bytes to contain random numbers.
			//
			// Exceptions:
			//   System.ArgumentNullException:
			//     buffer is null.
			public: virtual void NextBytes(Array<byte>* buffer);
			//
			// Summary:
			//     Returns a random number between 0.0 and 1.0.
			//
			// Returns:
			//     A double-precision floating point number greater than or equal to 0.0, and
			//     less than 1.0.
			//[TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
			public: virtual double NextDouble();
			//
			// Summary:
			//     Returns a random number between 0.0 and 1.0.
			//
			// Returns:
			//     A double-precision floating point number greater than or equal to 0.0, and
			//     less than 1.0.
			//[TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
			protected: virtual double Sample();
		};
	}
}

#endif